from conn import check_frame_label_col

clip_ids = []
with open("./clip_ids_target_100_19.txt") as fp:
    for line in fp:
        clip_ids.append(line.strip())


head = ["Clip ID", "A", "B", "C", "Total"]
out_list = [head]
for clip_id in clip_ids:
    total = 0
    a, b, c = 0, 0, 0
    frames = check_frame_label_col.find(
        {"clip_id": clip_id, "annotate_type": 19}, {"judging_standard": 1}
    ).to_list()
    for frame in frames:
        if frame["judging_standard"] == "A":
            a += 1
        elif frame["judging_standard"] == "B":
            b += 1
        elif frame["judging_standard"] == "C":
            c += 1
        total += 1
    out_list.append([clip_id, a, b, c, total])

with open("ac_rate_100_19.csv", "w") as fp:
    for line in out_list:
        fp.write(",".join(map(str, line)) + "\n")
